﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zocono.WCS.Domain.PlcBytesObject
{
    /// <summary>
    /// 四面托盘码 报文
    /// </summary>
    public class PlanarContainerCodesBO : BytesObjectBase
    {
        public string PalletBarcode { get; set; }
        public string PalletBarcode2 { get; set; }
        public string PalletBarcode3 { get; set; }
        public string PalletBarcode4 { get; set; }


        //public override byte[] Derialize()
        //{
        //    throw new NotImplementedException();
        //}

        public override void Serialize(long plcConnectionID, long plcReadDbID, int bytesIndex, int bytesLength, int objectIndex, int objectLength, string objectType, string ScEquipmentCode, byte[] bytes)
        {
            PlcConnectionID = plcConnectionID;
            PlcReadDbID = plcReadDbID;
            BytesIndex = bytesIndex;
            BytesLength = bytesLength;
            ObjectIndex = objectIndex;
            ObjectLength = objectLength;
            ObjectType = objectType;


            EquipmentCode = ScEquipmentCode;
            int length = HelperByte.GetSIntAt(bytes, 1);
            PalletBarcode = HelperByte.GetCharsAt(bytes, 2, length);
            int length2 = HelperByte.GetSIntAt(bytes, 21);
            PalletBarcode2 = HelperByte.GetCharsAt(bytes, 22, length2);
            int length3 = HelperByte.GetSIntAt(bytes, 41);
            PalletBarcode3 = HelperByte.GetCharsAt(bytes, 42, length3);
            int length4 = HelperByte.GetSIntAt(bytes, 61);
            PalletBarcode4 = HelperByte.GetCharsAt(bytes, 62, length4);


            //int length = HelperByte.GetByteAt(bytes, 1);
            //EquipmentCode = HelperByte.GetDIntAt(bytes, 0);
            //TaskCode = HelperByte.GetIntAt(bytes, 8);
            //length = HelperByte.GetByteAt(bytes, 13);
            //ToPosition = HelperByte.GetCharsAt(bytes, 14, length);
            //length = HelperByte.GetByteAt(bytes, 21);
            //PalletCode = HelperByte.GetCharsAt(bytes, 22, length);
            //OccupyStatus = HelperByte.GetIntAt(bytes, 40);//感应器
            //AlarmCode = HelperByte.GetIntAt(bytes, 42);
            //ActionState = HelperByte.GetIntAt(bytes, 44);
            //Reserve = HelperByte.GetIntAt(bytes, 46);
            //Reserve2 = HelperByte.GetIntAt(bytes, 48);
        }

    }
}
